#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 3e6 + 5;

int n, p;
ll f[N];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> p;
  f[1] = 1;
  rep(i, 2, n) {
    ll k = p / i;
    ll r = p % i;
    f[i] = -k * f[r] % p;
    if (f[i] < 0) f[i] += p;
  }
  rep(i, 1, n) cout << f[i] << endl;
  return 0;
}